package com.example.batchdemo.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description
 * @ClassName PageUtils
 * @Author jiang_11445266119198
 * @Date 2022/8/2 22:06
 */
public class PageUtils {

    public static Map<String, Integer> PageUtil(Integer page, Integer pageSize){
        int pageSizes = 10;
        if (StringNullUtil.isNotEmpty(String.valueOf(pageSize))){
            pageSizes = pageSize;
        }
        int pages = 0;
        if (StringNullUtil.isNotEmpty(String.valueOf(page)) && page > 1) {
            pages = (page - 1) * pageSizes;
        }
        HashMap<String, Integer> objectObjectHashMap = new HashMap<>();
        objectObjectHashMap.put("pages",pages);
        objectObjectHashMap.put("pageSizes",pageSizes);
        return objectObjectHashMap;
    }
}
